import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.BoxLayout;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JSlider;
import javax.swing.JButton;
import javax.swing.JTextPane;
import java.awt.Color;
import java.awt.Font;


public class IhmImpl extends JFrame {

	private JPanel contentPane;
	private JTextField measureDisplay;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					IhmImpl frame = new IhmImpl();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public IhmImpl() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 502, 202);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		
		JPanel screen = new JPanel();
		
		JPanel Tempo = new JPanel();
		
		JPanel onOffButtons = new JPanel();
		
		JPanel measureButtons = new JPanel();
		
		JPanel ledPanel = new JPanel();
		
		JPanel productName = new JPanel();
		GroupLayout gl_contentPane = new GroupLayout(contentPane);
		gl_contentPane.setHorizontalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addContainerGap()
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addComponent(onOffButtons, GroupLayout.PREFERRED_SIZE, 117, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED, 129, Short.MAX_VALUE)
							.addComponent(measureButtons, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
						.addComponent(Tempo, GroupLayout.DEFAULT_SIZE, 456, Short.MAX_VALUE)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addComponent(screen, GroupLayout.PREFERRED_SIZE, 118, GroupLayout.PREFERRED_SIZE)
							.addGap(57)
							.addComponent(productName, GroupLayout.PREFERRED_SIZE, 137, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED, 32, Short.MAX_VALUE)
							.addComponent(ledPanel, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE)))
					.addContainerGap())
		);
		gl_contentPane.setVerticalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addContainerGap()
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
								.addComponent(screen, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE)
								.addComponent(productName, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE))
							.addGap(18))
						.addComponent(ledPanel, GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE))
					.addComponent(Tempo, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
					.addGap(30)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
						.addComponent(onOffButtons, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(measureButtons, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)))
		);
		
		JLabel lblProductName = new JLabel("AOCMetronome");
		lblProductName.setFont(new Font("Tahoma", Font.BOLD, 16));
		GroupLayout gl_productName = new GroupLayout(productName);
		gl_productName.setHorizontalGroup(
			gl_productName.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_productName.createSequentialGroup()
					.addComponent(lblProductName, GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
					.addContainerGap())
		);
		gl_productName.setVerticalGroup(
			gl_productName.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_productName.createSequentialGroup()
					.addComponent(lblProductName, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
					.addContainerGap())
		);
		productName.setLayout(gl_productName);
		
		JPanel ledMeasure = new JPanel();
		ledMeasure.setBackground(Color.DARK_GRAY);
		
		JPanel ledTempo = new JPanel();
		ledTempo.setBackground(Color.DARK_GRAY);
		
		JLabel lblTempo = new JLabel("Tempo");
		
		JLabel lblMeasure = new JLabel("Measure");
		GroupLayout gl_ledPanel = new GroupLayout(ledPanel);
		gl_ledPanel.setHorizontalGroup(
			gl_ledPanel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_ledPanel.createSequentialGroup()
					.addContainerGap()
					.addGroup(gl_ledPanel.createParallelGroup(Alignment.LEADING, false)
						.addComponent(ledMeasure, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
						.addComponent(lblTempo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
					.addPreferredGap(ComponentPlacement.RELATED, 29, Short.MAX_VALUE)
					.addGroup(gl_ledPanel.createParallelGroup(Alignment.TRAILING, false)
						.addGroup(gl_ledPanel.createSequentialGroup()
							.addComponent(ledTempo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
							.addGap(10))
						.addComponent(lblMeasure)))
		);
		gl_ledPanel.setVerticalGroup(
			gl_ledPanel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_ledPanel.createSequentialGroup()
					.addContainerGap()
					.addGroup(gl_ledPanel.createParallelGroup(Alignment.LEADING)
						.addComponent(ledMeasure, GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE)
						.addComponent(ledTempo, GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(gl_ledPanel.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblTempo)
						.addComponent(lblMeasure)))
		);
		ledPanel.setLayout(gl_ledPanel);
		screen.setLayout(new BoxLayout(screen, BoxLayout.X_AXIS));
		
		JTextPane display = new JTextPane();
		display.setEditable(false);
		screen.add(display);
		
		measureDisplay = new JTextField();
		measureDisplay.setEditable(false);
		measureButtons.add(measureDisplay);
		measureDisplay.setColumns(10);
		
		JButton btnInc = new JButton("INC");
		measureButtons.add(btnInc);
		
		JButton btnDec = new JButton("DEC");
		measureButtons.add(btnDec);
		
		JButton btnOn = new JButton("ON");
		onOffButtons.add(btnOn);
		
		JButton btnOff = new JButton("OFF");
		onOffButtons.add(btnOff);
		Tempo.setLayout(new BoxLayout(Tempo, BoxLayout.X_AXIS));
		
		JLabel lblSetTempo = new JLabel("Set Tempo");
		Tempo.add(lblSetTempo);
		
		JSlider tempoSlider = new JSlider();
		Tempo.add(tempoSlider);
		contentPane.setLayout(gl_contentPane);
	}
}
